package com.apes.enquiry.supplier.baturu.model;

import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.scm.masterdata.enumeration.model.Enumeration;
import com.apes.scm.masterdata.frame.model.Store;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = BaturuAccountInfo.CONST_TABLE_NAME)
public class BaturuAccountInfo extends BaseModel {

    public static final String CONST_TABLE_NAME = "mas_baturu_account_info";

    @Id
    @Column(name = "id", length = 32)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "巴图鲁-账号信息")
    @Comment("编号")
    private String id;

    @Comment(value = "门店")
    @Column(name = "store_id")
    private String storeId; // 为了和服务方案推送老系统的门店一致，存的 Origin, 年后计划去掉

    @Comment(value = "巴图鲁唯一标识")
    @Column(name = "baturu_unique_sign")
    private String baturuUniqueSign;

    @Comment(value = "手机号")
    @Column(name = "mobile_phone")
    private String mobilePhone;

    @Comment(value = "账号状态")
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "account_status", referencedColumnName = "id")
    private Enumeration accountStatus;

    @Comment(value = "门店编码")
    @Column(name = "store_Number")
    private String storeNumber;
}
